﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    [ObjectEvent]
    public class RM_002Event : ObjectEvent<RM_002>, IAwake
    {
        public void Awake()
        {
            Get().Awake();
        }
    }
    /**
     * 攻击阶段，当本卡被相杀时，你可令对手选择一项：1.失去2点灵力 2.受到1500点特殊伤害。
     * */
    public class RM_002 : BattleEventComponent
    {
        public override BattleEventType[] EventType { get; set; } = new BattleEventType[] { BattleEventType.DefenceSuccess };

        public override async Task RunEvent(BattleEventType eventType, FightModel fightModel, params object[] param)
        {
            DamageInfo damageInfo = param[0] as DamageInfo;
            if (damageInfo.AttackCard == GetEntity<BattleCard>())
            {
                List<DecideInfo> list=new List<DecideInfo>();
                list.Add(new DecideInfo()
                {
                    Describe = "失去两点灵力",
                    CallBack = () =>
                    {                        
                        fightModel.GetDefencePlayer().ChangePower(new PowerInfo()
                        {
                            Power = 2,
                        });
                    },
                });
                list.Add(new DecideInfo()
                {
                    Describe = "受到1500点特殊伤害",
                    CallBack = () =>
                    {
                        fightModel.GetDefencePlayer().ChangeHp(new DamageInfo()
                        {
                            DamageType=DamageTypeEnum.Special,
                            DamageValue=1500,
                            AttackCard=damageInfo.AttackCard,
                        });
                    },
                });
                await BattleEventWatcherComponent.Single.RunEvent(BattleEventType.ShowWindow, fightModel, WindowType.Decide, list);
            }
        }
    }
}
